import java.util.Arrays;

/**
 * Created with Interllij IDEA.
 * Descriptiption:
 * User: 王澄慧
 * Date: 2022-04-10
 * Time: 7:52
 */
public class TestDemo {
    public static void main(String[] args) {
        int[] array ;
        array = new int[10];
        int[] array1;
        array1 = new int[]{1,2,3,4};
    }
    public static int find(int[] array,int i){
        for (int f = 0;f < array.length;f++){
            if(array[f] ==  i){
                return f;
            }
        }
        return -1;
    }
    public static void main8(String[] args) {
        int[] array = {1,2,34,12};
        System.out.println(find(array,12));
    }
    public static void main7(String[] args) {
        int[] array = {1,2,3,4,5};
        String newArray = Arrays.toString(array);
        System.out.println(newArray);
    }

    public static void funA(int[] i){
        i[1] = 12;
        System.out.println("i[1] = " + i[1]);
    }
    public static void main6(String[] args) {
        int[] array = {1,2,3,4};
        funA(array);
        System.out.println("array[1] = " + array[1]);
    }
    public static void fun(int i){
        i = 5;
        System.out.println("i = " + i);
    }
    public static void main5(String[] args) {
        int a = 6;
        fun(a);
        System.out.println("a = " + a);

    }
    public static void main4(String[] args) {
        int [] array = {1,2,3};
        for (int i = 0;i < array.length;i++ ) {
            System.out.println(array[i] + " ");
        }
    }
    public static void main3(String[] args) {
        int[] array = null;
        System.out.println(array[0]);
    }

    public static void main2(String[] args) {
        int a = 10;
        int b = 20;
        int[] array = {1,3,4};

    }
    public static void main1(String[] args) {
        int[] array = {12,2,31,4,52,6};
        for (int a = 0; a < array.length; a++) {
            System.out.println(array[a]);
        }
        for (int i:array) {
            System.out.println(i);
        }
        /*System.out.println(array[0]);
        System.out.println(array[1]);
        System.out.println(array[2]);
        System.out.println(array[3]);
        System.out.println(array[4]);
        System.out.println(array[5]);
       array[0] = 100;
        System.out.println(array[0]);
        System.out.println(array.length);*/
    }
}
